home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / gnu / djgpp / contrib / dvx / inc / dirent.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-15  |  1.8 KB  |  85 lines

  1. #ifndef __DIRENT_H__
  2. #define __DIRENT_H__
  3.  
  4. #ifdef __GNUC__
  5. /* DESQview/X does not replace GNU's open/read/closedir. POHC */
  6. #include <sys/dirent.h>
  7. #else /* __GNUC__ */
  8. #ifdef __WATCOMC__
  9. /* DESQview/X does not replace WATCOM's open/read/closedir. POHC */
  10. #include <direct.h>
  11. #else /* __WATCOMC__ */
  12.  
  13. #ifdef __NDPC__
  14. #include <os.h>
  15. #else
  16. #if defined(_MSC_VER) && (_M_IX86 >= 300)
  17. #include <pldos32.h>
  18. #define find_t _find_t
  19. #else
  20. #include <dos.h>
  21. #endif
  22. #endif
  23.  
  24. #define MAXNAMLEN    12        /* maximum filename length */
  25.  
  26. struct dirent {
  27.    short d_attr;
  28. #define d_attrib d_attr
  29.    short d_namlen;
  30.    char d_name[MAXNAMLEN + 1];
  31. };
  32.  
  33.  
  34. typedef struct _DIR /* Tagged. POHC 90/10/09 */
  35.     {
  36.     unsigned short    dd_nentry;    /* current entry in directory */
  37.     unsigned short    dd_valid;    /* whether entry is valid */
  38.     struct find_t    dd_find_t;    /* directory entry */
  39.     struct dirent    dd_dirent;    /* alternative directory entry */
  40.     }    DIR;            /* stream data from opendir() */
  41.  
  42. extern DIR        *opendir(char *dirname);
  43. extern struct dirent    *readdir(DIR *dp);
  44. extern int        closedir(DIR *dp);
  45.  
  46. #endif /* __WATCOMC__ */
  47. #endif /* __GNUC__*/
  48.  
  49. #ifndef NO_PROTO
  50.  
  51. #ifdef __cplusplus                      /* for C++ V2.0 */
  52.   extern "C" {   /* do not leave open across includes */
  53. #endif /* __cplusplus */
  54.  
  55. typedef int (*_Sortfunc) (
  56. #if NeedFunctionPtrPrototypes
  57.     const void *,
  58.     const void *
  59. #endif
  60. );
  61.  
  62. typedef int (*_Selectfunc) (
  63. #if NeedFunctionPtrPrototypes
  64.     struct dirent *
  65. #endif
  66. );
  67.  
  68. int scandir(const char *, struct dirent ***, _Selectfunc *, _Sortfunc *);
  69. int alphasort(const void *, const void *);
  70.  
  71. #ifdef __cplusplus                      /* for C++ V2.0 */
  72.   }
  73. #endif /* __cplusplus */
  74.  
  75. #else /* NO_PROTO */
  76.  
  77. int scandir();
  78. int alphasort();
  79.  
  80. #endif /* NO_PROTO */
  81.  
  82.  
  83. #endif /* __DIRENT_H_ */
  84.  
  85.